% kuka

clear
clc
%theta      d         a        alpha
 
%标准DH建模
L(1)=Link('d',0,'a',0.260,'alpha',-pi/2);
L(2)=Link('d',0,'a',0.680,'alpha',0);
L(3)=Link('d',0,'a',0.035,'alpha',pi/2);
L(4)=Link('d',0.670,'a',0,'alpha',pi/2);
L(5)=Link('d',0,'a',0,'alpha',pi/2);
L(6)=Link('d',0.158,'a',0,'alpha',0);
robot=SerialLink(L,'name','kr16');
 
%定义关节两偏移量 
robot.base=transl(0,0,0.675);
L(2).offset=-pi/2;
L(3).offset=pi;
L(4).offset=pi;
L(5).offset=pi;
L(6).offset=pi/2;
 
%定义关节变量范围
L(1).qlim=[deg2rad(-185) deg2rad(185)];
L(2).qlim=[deg2rad(-155) deg2rad(35)];
L(3).qlim=[deg2rad(-130) deg2rad(154)];
L(4).qlim=[deg2rad(-350) deg2rad(350)];
L(5).qlim=[deg2rad(-130) deg2rad(130)];
L(6).qlim=[deg2rad(-350) deg2rad(350)];
 
%调整坐标轴即视野
set(gca,'XLim',[-1,1.5]);  %将X轴范围设定为[-1.000,1.500]
set(gca,'YLim',[-1,1.5]);  %将X轴范围设定为[-1.000,1.500]
set(gca,'ZLim',[-1,1.5]);  %将Z轴范围设定为[-1.000,1.500]
% set(gca,'XDir','reverse');    %将x轴方向设置为反向
% set(gca,'YDir','reverse');    %将Y轴方向设置为反向
set(gca,'View',[50,20]);     %设定视野方向角和俯仰角
robot.display;
robot.teach;